﻿using KC.Service.Core.Enums.WorkFlow;
using KC.DTO.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace KC.Service.Core.DTO.WorkFlow
{
    [Serializable]
    [DataContract(IsReference = true)]
    public class WorkFlowTaskDto:EntityBaseDTO
    {
        public WorkFlowTaskDto()
        {
            IsDefault = false;
            ApplyTime = DateTime.UtcNow;
            LastApplyTime = DateTime.UtcNow;
            ProcessingState = ProcessingState.Untreated;
        }

        [DataMember]
        public Guid? Id { get; set; }
         [DataMember]
        public bool IsDefault { get; set; }

        [DataMember]
        public string GroupId { get; set; }

        [DataMember]
        public string NodeTitle { get; set; }

        [DataMember]
        public string FlowTitle { get; set; }

        /// <summary>
        /// 申请用户
        /// </summary>
        [DataMember]
        public string ApplyUserId { get; set; }

        /// <summary>
        /// 申请单号
        /// </summary>
        [DataMember]
        public string ApplyOrderId { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [DataMember]
        public DateTime ApplyTime { get; set; }

        public string ApplyLocalTime
        {
            get
            {
                return ApplyTime.AddHours(8).ToString("yyyy-MM-dd HH:mm:ss");
            }
        }

        /// <summary>
        /// 
        /// </summary>
        [DataMember]
        public DateTime LastApplyTime { get; set; }

        public string LastApplyLocalTime
        {
            get
            {
                return LastApplyTime.AddHours(8).ToString("yyyy-MM-dd HH:mm:ss");
            }
        }

        /// <summary>
        /// 申请数据
        /// </summary>
       [DataMember]
        public string ApplyData { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [DataMember]
        public string ApplyHtml { get; set; }

        /// <summary>
        /// 
        /// </summary>
        [DataMember]
        public string ApplyUrl { get; set; }

        /// <summary>
        /// 申请应用编号
        /// </summary>
        [DataMember]
        public Guid ApplicationId { get; set; }

        /// <summary>
        /// 审批状态
        /// </summary>
        [DataMember]
        public ProcessingState ProcessingState { get; set; }

        [DataMember]
        public string ProcessingStateString { get; set; }

        /// <summary>
        /// 审批人员
        /// </summary>
        [DataMember]
        public string UserIds { get; set; }

        /// <summary>
        /// 节点内容
        /// </summary>
        [DataMember]
        public string Content { get; set; }

        public List<WorkFlowTaskLogDto> WorkFlowTaskLogs { get; set; }

        public List<WorkFlowsDto> WorkFlows { get; set; }
    }
}
